package com.zpkj.eureka.consumer;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
//加入服务治理体系
@EnableDiscoveryClient
@SpringBootApplication
public class ConsumerAppStart {
	//初始化 RestTemplate
	@Bean
	//实现负载均衡restAPI调用
	@LoadBalanced
	public RestTemplate restTemplate(){
		return new RestTemplate();
	}
	
	public static void main(String[] args) {
		new SpringApplicationBuilder(ConsumerAppStart.class).web(true).run(args);
	}

}
